;		*** CODE8086.Z80 ***	VERSION 1.0	09/25/84
;	LAST EDIT 9/25/84
;
;	8086 INSTRUCTIONS TO EMULATE Z80 OP CODES
;
CODE00:					;NOP
	RET
CODE01:					;LD BC,nnnn
	INC	SI
	INC	SI
	MOV	Z_BC,BX
	SAHF
	RET
CODE02:					;LD (BC),A
	MOV	BX,Z_BC
	MOV	AL,Z_A
	MOV	ES:[BX],AL
	RET
CODE03:					;INC BC
	INC	Z_BC
	SAHF
	RET
CODE04:					;INC B
	INC	Z_B
	RET
CODE05:					;DEC B
	DEC	Z_B
	RET
CODE06:					;LD B,nn
	INC	SI
	MOV	Z_B,BL
	SAHF
	RET
CODE07:					;RLCA
	ROL	Z_A,1
	RET
CODE08:							;EX AF,AF'
	MOV	AX,Z_AF
	PUSH	AX
	MOV	AX,Z_ALTA
	MOV	Z_AF,AX
	POP	AX
	MOV	Z_ALTA,AX
	RET
CODE09:					;ADD HL,BC
	PUSHF
	MOV	AX,Z_BC
	ADD	Z_HL,AX
	JMP	CYSAV
CODE0A:					;LD A,(BC)
	MOV	BX,Z_BC
	MOV	AL,ES:[BX]
	MOV	Z_A,AL
	RET
CODE0B:					;DEC BC
	DEC	Z_BC
	SAHF
	RET
CODE0C:					;INC C
	INC	Z_C
	RET
CODE0D:					;DEC C
	DEC	Z_C
	RET
CODE0E:					;LD C,nn
	INC	SI
	MOV	Z_C,BL
	SAHF
	RET
CODE0F:					;RRCA
	RCR	Z_A,1
	RET
CODE10:							;DJNZ
	INC	SI
	DEC	Z_B
	JNZ	RELJMP
	RET
CODE11:					;LD DE,nnnn
	INC	SI
	INC	SI
	MOV	Z_DE,BX
	SAHF
	RET
CODE12:					;LD (DE),A
	MOV	BX,Z_DE
	MOV	AL,Z_A
	MOV	ES:[BX],AL
	RET
CODE13:					;INC DE
	INC	Z_DE
	SAHF
	RET
CODE14:					;INC D
	INC	Z_D
	RET
CODE15:					;DEC D
	DEC	Z_D
	RET
CODE16:					;LD D,nn
	INC	SI
	MOV	Z_D,BL
	SAHF
	RET
CODE17:					;RLA
	RCL	Z_A,1
	RET
CODE18:							;JR dd
	INC	SI
	SAHF
	JMPS	RELJMP
CODE19:					;ADD HL,DE
	PUSHF
	MOV	AX,Z_DE
	ADD	Z_HL,AX
CYSAV:	JC	CYSET
CYCLR:	POPF
	CLC
	RET
CYSET:	POPF
	STC
	RET
CODE1A:					;LD A,(DE)
	MOV	BX,Z_DE
	MOV	AL,ES:[BX]
	MOV	Z_A,AL
	RET
CODE1B:					;DEC DE
	DEC	Z_DE
	SAHF
	RET
CODE1C:					;INC E
	INC	Z_E
	RET
CODE1D:					;DEC E
	DEC	Z_E
	RET
CODE1E:					;LD E,nn
	INC	SI
	MOV	Z_E,BL
	SAHF
	RET
CODE1F:					;RRA
	RCR	Z_A,1
	RET
CODE20:							;JR NZ,dd
	INC	SI
	SAHF
	JNZ	RELJMP
	RET
RELJMP:	MOV	AL,BL
	CBW
	ADD	AX,SI
	MOV	SI,AX
	RET
CODE21:					;LD HL,nnnn
	INC	SI
	INC	SI
	MOV	Z_HL,BX
	SAHF
	RET
CODE22:					;LD (nnnn),HL
	INC	SI
	INC	SI
	SAHF
	MOV	AX,Z_HL
	MOV	ES:[BX],AX
	RET
CODE23:					;INC HL
	INC	Z_HL
	SAHF
	RET
CODE24:					;INC H
	INC	Z_H
	RET
CODE25:					;DEC H
	DEC	Z_H
	RET
CODE26:					;LD H,nn
	INC	SI
	MOV	Z_H,BL
	SAHF
	RET
CODE27:					;DAA
	MOV	AL,Z_A
	DAA
	MOV	Z_A,AL
	RET
CODE28:							;JR Z,dd
	INC	SI
	SAHF
	JZ	RELJMP
	RET
CODE29:					;ADD HL,HL
	PUSHF
	MOV	AX,Z_HL
	ADD	Z_HL,AX
	JMP	CYSAV
CODE2A:					;LD HL,(nnnn)
	INC	SI
	INC	SI
	SAHF
	MOV	AX,ES:[BX]
	MOV	Z_HL,AX
	RET
CODE2B:					;DEC HL
	DEC	Z_HL
	SAHF
	RET
CODE2C:					;INC L
	INC	Z_L
	RET
CODE2D:					;DEC L
	DEC	Z_L
	RET
CODE2E:					;LD L,nn
	INC	SI
	MOV	Z_L,BL
	SAHF
	RET
CODE2F:					;CPL
	XOR	Z_A,0FFH
	RET
CODE30:							;JR NC,dd
	INC	SI
	SAHF
	JNC	RELJMP
	RET
RJMP2:	JMPS	RELJMP
CODE31:					;LD SP,nnnn
	INC	SI
	INC	SI
	MOV	Z_SP,BX
	SAHF
	RET
CODE32:					;LD (nnnn),A
	INC	SI
	INC	SI
	MOV	AL,Z_A
	MOV	ES:[BX],AL
	SAHF
	RET
CODE33:					;INC SP
	INC	Z_SP
	SAHF
	RET
CODE34:					;INC (HL)
	MOV	BX,Z_HL
	INC	ES: BYTE PTR [BX]
	RET
CODE35:					;DEC (HL)
	MOV	BX,Z_HL
	DEC	ES: BYTE PTR [BX]
	RET
CODE36:					;LD (HL),nn
	INC	SI
	MOV	AL,BL
	MOV	BX,Z_HL
	MOV	ES:[BX],AL
	SAHF
	RET
CODE37:					;SCF
	STC
	RET
CODE38:							;JR C,dd
	INC	SI
	SAHF
	JC	RJMP2
	RET
CODE39:					;ADD HL,SP
	PUSHF
	MOV	AX,Z_SP
	ADD	Z_HL,AX
	JMP	CYSAV
CODE3A:					;LD A,(nnnn)
	INC	SI
	INC	SI
	MOV	AL,ES:[BX]
	MOV	Z_A,AL
	SAHF
	RET
CODE3B:					;DEC SP
	DEC	Z_SP
	SAHF
	RET
CODE3C:					;INC A
	INC	Z_A
	RET
CODE3D:					;DEC A
	DEC	Z_A
	RET
CODE3E:					;LD A,nn
	INC	SI
	MOV	Z_A,BL
	SAHF
	RET
CODE3F:					;CCF
	CMC
	RET
CODE40:					;LD B,B
	MOV	AL,Z_B
	MOV	Z_B,AL
	RET
CODE41:					;LD B,C
	MOV	AL,Z_C
	MOV	Z_B,AL
	RET
CODE42:					;LD B,D
	MOV	AL,Z_D
	MOV	Z_B,AL
	RET
CODE43:					;LD B,E
	MOV	AL,Z_E
	MOV	Z_B,AL
	RET
CODE44:					;LD B,H
	MOV	AL,Z_H
	MOV	Z_B,AL
	RET
CODE45:					;LD B,L
	MOV	AL,Z_L
	MOV	Z_B,AL
	RET
CODE46:					;LD B,(HL)
	MOV	BX,Z_HL
	MOV	AL,ES:[BX]
	MOV	Z_B,AL
	RET
CODE47:					;LD B,A
	MOV	AL,Z_A
	MOV	Z_B,AL
	RET
CODE48:					;LD C,B
	MOV	AL,Z_B
	MOV	Z_C,AL
	RET
CODE49:					;LD C,C
	MOV	AL,Z_C
	MOV	Z_C,AL
	RET
CODE4A:					;LD C,D
	MOV	AL,Z_D
	MOV	Z_C,AL
	RET
CODE4B:					;LD C,E
	MOV	AL,Z_E
	MOV	Z_C,AL
	RET
CODE4C:					;LD C,H
	MOV	AL,Z_H
	MOV	Z_C,AL
	RET
CODE4D:					;LD C,L
	MOV	AL,Z_L
	MOV	Z_C,AL
	RET
CODE4E:					;LD C,(HL)
	MOV	BX,Z_HL
	MOV	AL,ES:[BX]
	MOV	Z_C,AL
	RET
CODE4F:					;LD C,A
	MOV	AL,Z_A
	MOV	Z_C,AL
	RET
CODE50:					;LD D,B
	MOV	AL,Z_B
	MOV	Z_D,AL
	RET
CODE51:					;LD D,C
	MOV	AL,Z_C
	MOV	Z_D,AL
	RET
CODE52:					;LD D,D
	MOV	AL,Z_D
	MOV	Z_D,AL
	RET
CODE53:					;LD D,E
	MOV	AL,Z_E
	MOV	Z_D,AL
	RET
CODE54:					;LD D,H
	MOV	AL,Z_H
	MOV	Z_D,AL
	RET
CODE55:					;LD D,L
	MOV	AL,Z_L
	MOV	Z_D,AL
	RET
CODE56:					;LD D,(HL)
	MOV	BX,Z_HL
	MOV	AL,ES:[BX]
	MOV	Z_D,AL
	RET
CODE57:					;LD D,A
	MOV	AL,Z_A
	MOV	Z_D,AL
	RET
CODE58:					;LD E,B
	MOV	AL,Z_B
	MOV	Z_E,AL
	RET
CODE59:					;LD E,C
	MOV	AL,Z_C
	MOV	Z_E,AL
	RET
CODE5A:					;LD E,D
	MOV	AL,Z_D
	MOV	Z_E,AL
	RET
CODE5B:					;LD E,E
	MOV	AL,Z_E
	MOV	Z_E,AL
	RET
CODE5C:					;LD E,H
	MOV	AL,Z_H
	MOV	Z_E,AL
	RET
CODE5D:					;LD E,L
	MOV	AL,Z_L
	MOV	Z_E,AL
	RET
CODE5E:					;LD E,(HL)
	MOV	BX,Z_HL
	MOV	AL,ES:[BX]
	MOV	Z_E,AL
	RET
CODE5F:					;LD E,A
	MOV	AL,Z_A
	MOV	Z_E,AL
	RET
CODE60:					;LD H,B
	MOV	AL,Z_B
	MOV	Z_H,AL
	RET
CODE61:					;LD H,C
	MOV	AL,Z_C
	MOV	Z_H,AL
	RET
CODE62:					;LD H,D
	MOV	AL,Z_D
	MOV	Z_H,AL
	RET
CODE63:					;LD H,E
	MOV	AL,Z_E
	MOV	Z_H,AL
	RET
CODE64:					;LD H,H
	MOV	AL,Z_H
	MOV	Z_H,AL
	RET
CODE65:					;LD H,L
	MOV	AL,Z_L
	MOV	Z_H,AL
	RET
CODE66:					;LD H,(HL)
	MOV	BX,Z_HL
	MOV	AL,ES:[BX]
	MOV	Z_H,AL
	RET
CODE67:					;LD H,A
	MOV	AL,Z_A
	MOV	Z_H,AL
	RET
CODE68:					;LD L,B
	MOV	AL,Z_B
	MOV	Z_L,AL
	RET
CODE69:					;LD L,C
	MOV	AL,Z_C
	MOV	Z_L,AL
	RET
CODE6A:					;LD L,D
	MOV	AL,Z_D
	MOV	Z_L,AL
	RET
CODE6B:					;LD L,E
	MOV	AL,Z_E
	MOV	Z_L,AL
	RET
CODE6C:					;LD L,H
	MOV	AL,Z_H
	MOV	Z_L,AL
	RET
CODE6D:					;LD L,L
	MOV	AL,Z_L
	MOV	Z_L,AL
	RET
CODE6E:					;LD L,(HL)
	MOV	BX,Z_HL
	MOV	AL,ES:[BX]
	MOV	Z_L,AL
	RET
CODE6F:					;LD L,A
	MOV	AL,Z_A
	MOV	Z_L,AL
	RET
CODE70:					;LD (HL),B
	MOV	BX,Z_HL
	MOV	AL,Z_B
	MOV	ES:[BX],AL
	RET
CODE71:					;LD (HL),C
	MOV	BX,Z_HL
	MOV	AL,Z_C
	MOV	ES:[BX],AL
	RET
CODE72:					;LD (HL),D
	MOV	BX,Z_HL
	MOV	AL,Z_D
	MOV	ES:[BX],AL
	RET
CODE73:					;LD (HL),E
	MOV	BX,Z_HL
	MOV	AL,Z_E
	MOV	ES:[BX],AL
	RET
CODE74:					;LD (HL),H
	MOV	BX,Z_HL
	MOV	AL,Z_H
	MOV	ES:[BX],AL
	RET
CODE75:					;LD (HL),L
	MOV	BX,Z_HL
	MOV	AL,Z_L
	MOV	ES:[BX],AL
	RET
CODE76:					;HALT
	HLT
	RET
CODE77:					;LD (HL),A
	MOV	BX,Z_HL
	MOV	AL,Z_A
	MOV	ES:[BX],AL
	RET
CODE78:					;LD A,B
	MOV	AL,Z_B
	MOV	Z_A,AL
	RET
CODE79:					;LD A,C
	MOV	AL,Z_C
	MOV	Z_A,AL
	RET
CODE7A:					;LD A,D
	MOV	AL,Z_D
	MOV	Z_A,AL
	RET
CODE7B:					;LD A,E
	MOV	AL,Z_E
	MOV	Z_A,AL
	RET
CODE7C:					;LD A,H
	MOV	AL,Z_H
	MOV	Z_A,AL
	RET
CODE7D:					;LD A,L
	MOV	AL,Z_L
	MOV	Z_A,AL
	RET
CODE7E:					;LD A,(HL)
	MOV	BX,Z_HL
	MOV	AL,ES:[BX]
	MOV	Z_A,AL
	RET
CODE7F:					;LD A,A
	MOV	AL,Z_A
	MOV	Z_A,AL
	RET
CODE80:					;ADD A,B
	MOV	AL,Z_B
	ADD	Z_A,AL
	RET
CODE81:					;ADD A,C
	MOV	AL,Z_C
	ADD	Z_A,AL
	RET
CODE82:					;ADD A,D
	MOV	AL,Z_D
	ADD	Z_A,AL
	RET
CODE83:					;ADD A,E
	MOV	AL,Z_E
	ADD	Z_A,AL
	RET
CODE84:					;ADD A,H
	MOV	AL,Z_H
	ADD	Z_A,AL
	RET
CODE85:					;ADD A,L
	MOV	AL,Z_L
	ADD	Z_A,AL
	RET
CODE86:					;ADD A,(HL)
	MOV	BX,Z_HL
	MOV	AL,ES:[BX]
	ADD	Z_A,AL
	RET
CODE87:					;ADD A,A
	MOV	AL,Z_A
	ADD	Z_A,AL
	RET
CODE88:					;ADC A,B
	MOV	AL,Z_B
	ADC	Z_A,AL
	RET
CODE89:					;ADC A,C
	MOV	AL,Z_C
	ADC	Z_A,AL
	RET
CODE8A:					;ADC A,D
	MOV	AL,Z_D
	ADC	Z_A,AL
	RET
CODE8B:					;ADC A,E
	MOV	AL,Z_E
	ADC	Z_A,AL
	RET
CODE8C:					;ADC A,H
	MOV	AL,Z_H
	ADC	Z_A,AL
	RET
CODE8D:					;ADC A,L
	MOV	AL,Z_L
	ADC	Z_A,AL
	RET
CODE8E:					;ADC A,(HL)
	MOV	BX,Z_HL
	MOV	AL,ES:[BX]
	ADC	Z_A,AL
	RET
CODE8F:					;ADC A,A
	MOV	AL,Z_A
	ADC	Z_A,AL
	RET
CODE90:					;SUB B
	MOV	AL,Z_B
	SUB	Z_A,AL
	RET
CODE91:					;SUB C
	MOV	AL,Z_C
	SUB	Z_A,AL
	RET
CODE92:					;SUB D
	MOV	AL,Z_D
	SUB	Z_A,AL
	RET
CODE93:					;SUB E
	MOV	AL,Z_E
	SUB	Z_A,AL
	RET
CODE94:					;SUB H
	MOV	AL,Z_H
	SUB	Z_A,AL
	RET
CODE95:					;SUB L
	MOV	AL,Z_L
	SUB	Z_A,AL
	RET
CODE96:					;SUB (HL)
	MOV	BX,Z_HL
	MOV	AL,ES:[BX]
	SUB	Z_A,AL
	RET
CODE97:					;SUB A
	MOV	AL,Z_A
	SUB	Z_A,AL
	RET
CODE98:					;SBC A,B
	MOV	AL,Z_B
	SBB	Z_A,AL
	RET
CODE99:					;SBC A,C
	MOV	AL,Z_C
	SBB	Z_A,AL
	RET
CODE9A:					;SBC A,D
	MOV	AL,Z_D
	SBB	Z_A,AL
	RET
CODE9B:					;SBC A,E
	MOV	AL,Z_E
	SBB	Z_A,AL
	RET
CODE9C:					;SBC A,H
	MOV	AL,Z_H
	SBB	Z_A,AL
	RET
CODE9D:					;SBC A,L
	MOV	AL,Z_L
	SBB	Z_A,AL
	RET
CODE9E:					;SBC A,(HL)
	MOV	BX,Z_HL
	MOV	AL,ES:[BX]
	SBB	Z_A,AL
	RET
CODE9F:					;SBC A,A
	MOV	AL,Z_A
	SBB	Z_A,AL
	RET
CODEA0:					;AND B
	MOV	AL,Z_B
	AND	Z_A,AL
	RET
CODEA1:					;AND C
	MOV	AL,Z_C
	AND	Z_A,AL
	RET
CODEA2:					;AND D
	MOV	AL,Z_D
	AND	Z_A,AL
	RET
CODEA3:					;AND E
	MOV	AL,Z_E
	AND	Z_A,AL
	RET
CODEA4:					;AND H
	MOV	AL,Z_H
	AND	Z_A,AL
	RET
CODEA5:					;AND L
	MOV	AL,Z_L
	AND	Z_A,AL
	RET
CODEA6:					;AND (HL)
	MOV	BX,Z_HL
	MOV	AL,ES:[BX]
	AND	Z_A,AL
	RET
CODEA7:					;AND A
	MOV	AL,Z_A
	AND	Z_A,AL
	RET
CODEA8:					;XOR B
	MOV	AL,Z_B
	XOR	Z_A,AL
	RET
CODEA9:					;XOR C
	MOV	AL,Z_C
	XOR	Z_A,AL
	RET
CODEAA:					;XOR D
	MOV	AL,Z_D
	XOR	Z_A,AL
	RET
CODEAB:					;XOR E
	MOV	AL,Z_E
	XOR	Z_A,AL
	RET
CODEAC:					;XOR H
	MOV	AL,Z_H
	XOR	Z_A,AL
	RET
CODEAD:					;XOR L
	MOV	AL,Z_L
	XOR	Z_A,AL
	RET
CODEAE:					;XOR (HL)
	MOV	BX,Z_HL
	MOV	AL,ES:[BX]
	XOR	Z_A,AL
	RET
CODEAF:					;XOR A
	MOV	AL,Z_A
	XOR	Z_A,AL
	RET
CODEB0:					;OR B
	MOV	AL,Z_B
	OR	Z_A,AL
	RET
CODEB1:					;OR C
	MOV	AL,Z_C
	OR	Z_A,AL
	RET
CODEB2:					;OR D
	MOV	AL,Z_D
	OR	Z_A,AL
	RET
CODEB3:					;OR E
	MOV	AL,Z_E
	OR	Z_A,AL
	RET
CODEB4:					;OR H
	MOV	AL,Z_H
	OR	Z_A,AL
	RET
CODEB5:					;OR L
	MOV	AL,Z_L
	OR	Z_A,AL
	RET
CODEB6:					;OR (HL)
	MOV	BX,Z_HL
	MOV	AL,ES:[BX]
	OR	Z_A,AL
	RET
CODEB7:					;OR A
	MOV	AL,Z_A
	OR	Z_A,AL
	RET
CODEB8:					;CP B
	MOV	AL,Z_B
	CMP	Z_A,AL
	RET
CODEB9:					;CP C
	MOV	AL,Z_C
	CMP	Z_A,AL
	RET
CODEBA:					;CP D
	MOV	AL,Z_D
	CMP	Z_A,AL
	RET
CODEBB:					;CP E
	MOV	AL,Z_E
	CMP	Z_A,AL
	RET
CODEBC:					;CP H
	MOV	AL,Z_H
	CMP	Z_A,AL
	RET
CODEBD:					;CP L
	MOV	AL,Z_L
	CMP	Z_A,AL
	RET
CODEBE:					;CP (HL)
	MOV	BX,Z_HL
	MOV	AL,ES:[BX]
	CMP	Z_A,AL
	RET
CODEBF:					;CP A
	MOV	AL,Z_A
	CMP	Z_A,AL
	RET
CODEC0:					;RET NZ
	JZ	RETC0
	JMP	Z80_RET
RETC0:	RET
CODEC1:					;POP BC
	CALL	Z80_POP
	MOV	Z_BC,AX
	RET
CODEC2:					;JP NZ nnnn
	INC	SI
	INC	SI
	SAHF
	JZ	RETC2
	MOV	SI,BX
RETC2:	RET
CODEC3:					;JP nnnn
	MOV	SI,BX
	RET
CODEC4:					;CALL NZ,nnnn
	INC	SI
	INC	SI
	SAHF
	JZ	RETC4
	JMP	Z80_CALL
RETC4:	RET
CODEC5:					;PUSH BC
	MOV	AX,Z_BC
	CALL	Z80_PUSH
	RET
CODEC6:					;ADD A,nn
	INC	SI
	ADD	Z_A,BL
	RET
CODEC7:					;RST 0
	MOV	BX,0
	JMP	Z80_CALL
	RET
CODEC8:					;RET Z
	JNZ	RETC8
	JMP	Z80_RET
RETC8:	RET
CODEC9:					;RET
	JMP	Z80_RET
	RET
CODECA:					;JP Z,nnnn
	INC	SI
	INC	SI
	SAHF
	JNZ	RETCA
	MOV	SI,BX
RETCA:	RET
CODECB:							;MULTIPLE
	PUSH	AX
	INC	SI		;USED A BYTE
	MOV	DI,BX
	AND	DI,00FFH
	SAL	DI,1
	POP	AX
	SAHF
	MOV	CX,CBTBL[DI]
	JMP	CX
CODECC:					;CALL Z,nnnn
	INC	SI
	INC	SI
	SAHF
	JNZ	RETCC
	JMP	Z80_CALL
RETCC:	RET
CODECD:					;CALL nnnn
	INC	SI
	INC	SI
	SAHF
	JMP	Z80_CALL
	RET
CODECE:					;ADC A,nn
	INC	SI
	ADC	Z_A,BL
	RET
CODECF:					;RST 8
	MOV	BX,8
	JMP	Z80_CALL
	RET
CODED0:					;RET NC
	JC	RETD0
	JMP	Z80_RET
RETD0:	RET
CODED1:					;POP DE
	CALL	Z80_POP
	MOV	Z_DE,AX
	RET
CODED2:					;JP NC,nnnn
	INC	SI
	INC	SI
	SAHF
	JC	RETD2
	MOV	SI,BX
RETD2:	RET
CODED3:					;OUT (nn),A
	INC	SI
	SAHF
	MOV	DH,0
	MOV	DL,BL
	MOV	AL,Z_A
	OUT	DX,AL
	RET
CODED4:					;CALL NC,nnnn
	INC	SI
	INC	SI
	SAHF
	JC	RETD4
	JMP	Z80_CALL
RETD4:	RET
CODED5:					;PUSH DE
	MOV	AX,Z_DE
	CALL	Z80_PUSH
	RET
CODED6:					;SUB nn
	INC	SI
	SUB	Z_A,BL
	RET
CODED7:					;RST 10
	MOV	BX,010H
	JMP	Z80_CALL
	RET
CODED8:					;RET C
	JNC	RETD8
	JMP	Z80_RET
RETD8:	RET
CODED9:							;EXX
	PUSH	DS
	PUSH	ES
	POP	DS
	PUSH	SI
	PUSH	DI
	PUSH	CX
	MOV	SI,Z_BC
	MOV	DI,Z_TEMP
	MOV	CX,3
	REP	MOVSW
	MOV	SI,Z_ALTR
	MOV	DI,Z_BC
	MOV	CX,3
	REP	MOVSW
	MOV	SI,Z_TEMP
	MOV	DI,Z_ALTR
	MOV	CX,3
	REP	MOVSW
	POP	CX
	POP	DI
	POP	SI
	POP	DS
	RET
CODEDA:					;JP C,nnnn
	INC	SI
	INC	SI
	SAHF
	JNC	RETDA
	MOV	SI,BX
RETDA:	RET
CODEDB:					;IN A,(nn)
	INC	SI
	SAHF
	MOV	DH,0
	MOV	DL,BL
	IN	AL,DX
	MOV	Z_A,AL
	RET
CODEDC:					;CALL C,nnnn
	INC	SI
	INC	SI
	SAHF
	JNC	RETDC
	JMP	Z80_CALL
RETDC:	RET
CODEDD:							;MULTIPLE
	JMP	Z80_NFG
CODEDE:					;SBC A,nn
	INC	SI
	SBB	Z_A,BL
	RET
CODEDF:					;RST 18
	MOV	BX,018H
	JMP	Z80_CALL
	RET
CODEE0:					;RET PO
	JPE	RETE0
	JMP	Z80_RET
RETE0:	RET
CODEE1:					;POP HL
	CALL	Z80_POP
	MOV	Z_HL,AX
	RET
CODEE2:					;JP PO,nnnn
	INC	SI
	INC	SI
	SAHF
	JPE	RETE2
	MOV	SI,BX
RETE2:	RET
CODEE3:					;EX (SP),HL
	MOV	AX,Z_HL
	MOV	BX,Z_SP
	XCHG	AX,ES:[BX]
	MOV	Z_HL,AX
	RET
CODEE4:					;CALL PO,nnnn
	INC	SI
	INC	SI
	SAHF
	JPE	RETE4
	JMP	Z80_CALL
RETE4:	RET
CODEE5:					;PUSH HL
	MOV	AX,Z_HL
	CALL	Z80_PUSH
	RET
CODEE6:					;AND nn
	INC	SI
	AND	Z_A,BL
	RET
CODEE7:					;RST 20
	MOV	BX,020H
	JMP	Z80_CALL
	RET
CODEE8:					;RET PE
	JPO	RETE8
	JMP	Z80_RET
RETE8:	RET
CODEE9:					;JP (HL)
	MOV	SI,Z_HL
	RET
CODEEA:					;JP PE nnnn
	INC	SI
	INC	SI
	SAHF
	JPO	RETEA
	MOV	SI,BX
RETEA:	RET
CODEEB:					;EX DE,HL
	MOV	AX,Z_HL
	XCHG	AX,Z_DE
	MOV	Z_HL,AX
	RET
CODEEC:					;CALL PE,nnnn
	INC	SI
	INC	SI
	SAHF
	JPO	RETEC
	JMP	Z80_CALL
RETEC:	RET
CODEED:							;MULTIPLE
	PUSH	AX
	INC	SI		;USED A BYTE
	MOV	AX,BX
	AND	AX,007FH	;SMALLER MAP
	SUB	AX,32
	ADD	AX,AX
	MOV	DI,AX
	POP	AX
	SAHF
	MOV	CX,EDTBL[DI]
	JMP	CX
CODEEE:					;XOR nn
	INC	SI
	XOR	Z_A,BL
	RET
CODEEF:					;RST 28
	MOV	BX,028H
	JMP	Z80_CALL
	RET
CODEF0:					;RET P
	JS	RETF0
	JMP	Z80_RET
RETF0:	RET
CODEF1:					;POP AF
	CALL	Z80_POP
	MOV	Z_A,AL
	SAHF
	RET
CODEF2:					;JP P,nnnn
	INC	SI
	INC	SI
	SAHF
	JS	RETF2
	MOV	SI,BX
RETF2:	RET
CODEF3:					;DI
	CLI
	RET
CODEF4:					;CALL P,nnnn
	INC	SI
	INC	SI
	SAHF
	JS	RETF4
	JMP	Z80_CALL
RETF4:	RET
CODEF5:					;PUSH AF
	LAHF
	MOV	AL,Z_A
	CALL	Z80_PUSH
	RET
CODEF6:					;OR nn
	INC	SI
	OR	Z_A,BL
	RET
CODEF7:					;RST 30
	MOV	BX,030H
	JMP	Z80_CALL
	RET
CODEF8:					;RET M
	JNS	RETF8
	JMP	Z80_RET
RETF8:	RET
CODEF9:					;LD SP,HL
	MOV	AX,Z_HL
	MOV	Z_SP,AX
	RET
CODEFA:					;JP M,nnnn
	INC	SI
	INC	SI
	SAHF
	JNS	RETFA
	MOV	SI,BX
RETFA:	RET
CODEFB:					;EI
	STI
	RET
CODEFC:					;CALL M,nnnn
	INC	SI
	INC	SI
	SAHF
	JNS	RETFC
	JMP	Z80_CALL
RETFC:	RET
CODEFD:							;MULTIPLE
	JMP	Z80_NFG
CODEFE:					;CP nn
	INC	SI
	CMP	Z_A,BL
	RET
CODEFF:					;RST 38
	MOV	BX,038H
	JMP	Z80_CALL
	RET
Z80_PUSH:
	PUSH	BX
	PUSHF
	DEC	Z_SP
	DEC	Z_SP
	MOV	BX,Z_SP
	MOV	ES:[BX],AX
	POPF
	POP	BX
	RET
Z80_POP:
	PUSH	BX
	PUSHF
	MOV	BX,Z_SP
	MOV	AX,ES:[BX]
	INC	Z_SP
	INC	Z_SP
	POPF
	POP	BX
	RET
Z80_CALL:
	MOV	AX,SI
	CALL	Z80_PUSH
	MOV	SI,BX
	RET
Z80_RET:
	CALL	Z80_POP
	MOV	SI,AX
	RET
Z80_NFG:				;Z80 ONLY OP CODE DETECTED
	MOV	DX,OFFSET MSG_Z80_OP
	CALL	PRINT
	MOV	SI,0FFFFH		;TERMINATE ON NEXT INSTRUCTION
	RET
